#include<iostream>
using namespace std;
typedef long long LL;
const int N = 110;
LL f[N][N];
int n, m;
int l[N], r[N];
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> l[i] >> r[i];
	}
	for (int i = l[i]; i <= r[i]; i++) {
		f[1][i] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m ; j++) {
			for (int k = l[i]; k <= r[i]; k++) {
				if (j >= k) {
					f[i][j] += f[i - 1][j - k];
				}
			}
		}
	}
	cout << f[n][m] << endl;
	return 0;
}